import React, { useSyncExternalStore } from 'react'
import store from './store'

export default function Child() {
  const state = useSyncExternalStore(store.subscribe, () => {
    return store.getSnapshot()
  })

  return (
    <div>Child: {state.data}</div>
  )
}
